home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 098 / eds.arc / EDSCENTX.LSP < prev    next >
Encoding:
Text File  |  1987-03-14  |  1005 b   |  33 lines

  1. ;This function centers any number of text lines
  2. ;at the midpoint of two vertices (ie opposite corners
  3. ;of a box) given the text size.
  4. ;
  5. ;Function name "EDSCENTX.LSP"  - Execution command "CT"
  6. ;
  7. ;Written by Steve Brown and Christopher Conrad
  8. ;
  9. ;
  10. (defun c:ct ()
  11.    (setq tsiz (getreal "Enter textsize :"))
  12.    (setq nl (getreal "Number of text lines : "))
  13.    (setq count 1)
  14.    (command "osnap" "int")
  15.    (setq pt1 (getpoint "select 1rst corner"))
  16.    (terpri)
  17.    (setq pt2 (getpoint "select 2nd corner"))
  18.    (terpri)
  19.    (setq pt3x (/ (- (car pt2) (car pt1)) 2))
  20.    (setq pt3y (/ (- (cadr pt2) (cadr pt1)) 2))
  21.    (setq tp (list (+ (car pt1) pt3x) (+ (cadr pt1) pt3y)))
  22.    (setq ofs (/ (1- nl) 2))
  23.    (while (<= count nl)
  24.      (setq tpl (list (car tp) (+ (cadr tp) (* (* tsiz 1.7143)
  25.      ofs))))
  26.      (setq tinp (getstring T "Input text : "))
  27.      (command "text" "m" tpl tsiz "0" tinp)
  28.      (setq ofs (1- ofs))
  29.      (setq count (1+ count))
  30.      (command "osnap" "off")
  31.    )
  32. )
  33.